package com.team.book.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.jws.WebParam;

/**
 * Created by haolw on 5/9/17.
 *
 * @version 0.0.1
 */
@Controller
public class DashboardController {

    @RequestMapping(value = {"/","/index","/dashboard"})
    public ModelAndView index(){
        ModelAndView mv = new ModelAndView("index");
        mv.addObject("menu","dashboard");
        return mv;
    }

    @RequestMapping(value = "/user",method = RequestMethod.GET)
    public ModelAndView user(){
        ModelAndView mv = new ModelAndView("user/list");
        mv.addObject("menu","user");
        return mv;
    }

    @RequestMapping(value = "/book",method = RequestMethod.GET)
    public ModelAndView book(){
        ModelAndView book = new ModelAndView("book/list");
        book.addObject("menu","book");
        return book;
    }

    @RequestMapping(value = "/records",method = RequestMethod.GET)
    public ModelAndView borrowedRecord(){
        ModelAndView record = new ModelAndView("book/record");
        record.addObject("menu","borrowed_record");
        return record;
    }

    @RequestMapping(value = "/book/type",method = RequestMethod.GET)
    public ModelAndView bookType(){
        ModelAndView bookType = new ModelAndView("book/type");
        bookType.addObject("menu","book");
        bookType.addObject("sub_menu","book_type");
        return bookType;
    }

    @RequestMapping(value = "/stats/classification",method = RequestMethod.GET)
    public ModelAndView statsByType(){
        ModelAndView mv = new ModelAndView("stats/type");
        mv.addObject("menu","stats");
        mv.addObject("sub_menu","type");
        return mv;
    }

    @RequestMapping(value = "/stats/borrow",method = RequestMethod.GET)
    public ModelAndView statsByBorrow(){
        ModelAndView mv = new ModelAndView("stats/borrow");
        mv.addObject("menu","stats");
        mv.addObject("sub_menu","borrow");
        return mv;
    }
}
